package com.food.foodapi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.food.foodapi.model.entity.Article;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author 92110
 */
@Mapper
public interface ArticleMapper extends BaseMapper<Article> {
    @Select("SELECT COUNT(*) AS todayNum FROM food_article WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = CURDATE()")
    Integer getTodayNum();

    @Select("SELECT COUNT(*) AS yesterdayNum FROM food_article WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = CURDATE() - INTERVAL 1 DAY")
    Integer getYesterdayNum();

    @Select("SELECT COUNT(*) FROM food_article")
    Integer getArticleNum();
}
